import { Vector3, PlaneGeometry, MeshBasicMaterial, Mesh, Scene, BufferGeometry, Camera, Group, Material, NormalBufferAttributes, Object3DEventMap, WebGLRenderer } from "three"


//旋转的圆环
export default class Annular extends Mesh {
    options: any;
    constructor(options: any) {
        super();
        this.options = options;
        this.geometry = new PlaneGeometry(options.width, options.width);
        this.material.map = options.map;
        this.material.opacity = options.opacity || 1;
        this.rotateX(-Math.PI / 2)
    }

    material = new MeshBasicMaterial({
        transparent: true,
        opacity: 1,
        depthTest: true,
        color: 0x2aa8ac
    })

    onBeforeRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry<NormalBufferAttributes>, material: Material, group: Group<Object3DEventMap>): void {
        this.rotation.z += this.options.rotateSpeed;
    }

}
